package com.lc.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.pojo.*;
import com.lc.service.TmenberService;
import com.lc.vo.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * 会员管理
 */
@RestController
@RequestMapping("/lctmeber")
public class TmenberController {

    @Resource
    private TmenberService  service;

    /**
     * 分页
     * @param pageVo
     * @return
     */
    @PostMapping("/querytmenupage")
    public PageInfo querytmenupage(@RequestBody() pageVo<Tmenberview> pageVo){
        return this.service.selectmenberpageService(pageVo);
    }

    /**
     * 禁用或者启用档案
     * @param id
     * @param status
     * @return
     */
    @GetMapping("/deleteBytmenberid")
    public int deleteBytmenberid(int id,int status){
        this.service.deletePhysicalBytmenberidService(id,status);
        return 1;
    }

    /**
     * 查询正常状态的建康管理师
     * @return
     */
    @GetMapping("/queryallthealthmgr")
    public List<TUser> queryallthealthmgr(){
        return this.service.queryallthealthmgrsEervice();
    }

    /**
     * 添加会员档案的Controller
     * @param tmenberview
     * @return
     */
    @PostMapping("/addtmember")
    public int addtmemberController(@RequestBody() Tmenberview tmenberview){
//        System.out.println(tmenberview);
        this.service.addtmemberService(tmenberview);
        return 1;
    }

    /**
     * 修改会员档案的Controller
     * @param tmenberview
     * @return
     */
    @PostMapping("/updatetmembercontroller")
    public int updatetmembercontroller(@RequestBody() Tmenberview tmenberview){
        System.out.println(tmenberview);
        this.service.updatetmenberService(tmenberview);
        return 1;
    }

    /**
     * 体检上传——查询会员检查
     * @param pageVo
     * @return
     */
    @PostMapping("/selecttmenmberexamincontroller")
    public PageInfo<TmemberexaminsetmealView> selecttmenmberexamincontroller(@RequestBody()  pageVo<TmemberexaminsetmealView> pageVo){
        System.out.println(pageVo);
        System.out.println(1);
        return this.service.selecttmenmberexamin(pageVo);
    }

    /**
     * 会员统计渲染
     * @param view
     * @return
     */
    @PostMapping("/querystatisticscontroller")
    public querystatisticsView querystatisticscontroller(@RequestBody querystatisticsView view){
        return this.service.querystatisticsService(view);
    }

    /**
     * 新增体检
     * @param
     * @return
     */
    @PostMapping("/addmemberexamincontroller")
    public int addmemberexamincontroller(@RequestBody() TMemberExamination tMemberExamination){
        return this.service.addmemberexaminService(tMemberExamination);
    }

    /**
     * 查询套餐——体检
     * @param tSetmeal
     * @return
     */
    @PostMapping("/querysetmealnamecontroller")
    public List<TSetmeal> querysetmealnamecontroller(@RequestBody() TSetmeal tSetmeal){
        return this.service.querysetmealname(tSetmeal);

    }

    @PostMapping("/schuanmemberexamincontroller")
    public int  schuanmemberexamincontroller(@RequestBody() ExaminView view){
        return this.service.schuanmemberexaminService(view);
    }

    /**
     * 手机验证码
     * @param phone
     * @return
     */
    @GetMapping("/huoquyanzhengmacontroller")
    public int huoquyanzhengmacontroller(String phone){
        return this.service.huoquyanzhengmaService(phone);
    }

    /**
     * 删除会员
     * @param id
     * @return
     */
    @GetMapping("/deletemembercontroller")
    public int deletemembercontroller(int id){
        this.service.deletememberService(id);
        return 1;
    }

    /**
     * 删除报告
     */
    @GetMapping("/deletemembererxaminconteoller")
    public int deletemembererxaminconteoller(int id){
        this.service.deletemembererxamin(id);
        return 1;
    }



}
